﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Master.Master" Inherits="System.Web.Mvc.ViewPage<OnlineMovieTicket.ViewModels.MovieAssignmentSearchModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<link type="text/css" href="<%= Url.Content("~/Content/themes/base/jquery.ui.all.css") %>" rel="stylesheet" /> 
<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-1.4.2.js") %>" ></script>  
<script type="text/javascript" src="<%= Url.Content("~/Scripts/ui/jquery.ui.core.js") %>"></script> 
<script type="text/javascript" src="<%= Url.Content("~/Scripts/ui/jquery.ui.widget.js") %>"></script> 
<script type="text/javascript" src="<%= Url.Content("~/Scripts/ui/jquery.ui.datepicker.js") %>"></script>     
<script type="text/javascript" src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" ></script>  
<script type="text/javascript" src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" ></script>  
<!-- <script type="text/javascript" src="<%= Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>" ></script> -->
 <script type="text/javascript" >
     $(function () {
         var date = $('#ShowingDate').datepicker({ dateFormat: 'dd-MM-yy' });
         GetCinemaHallList();
     });

 </script>

    <% using (Ajax.BeginForm("Search", new AjaxOptions { UpdateTargetId = "SearchResult" }))
       { %>

        <table cellpadding="0" cellspacing="0"  class="pageBackGround">
                                    <tr height="10px"><% Html.EnableClientValidation(); %>
                                                      <% using (Html.BeginForm()) {%></tr>
                                    <tr><td class="fontWhite">
                                        <table bgcolor="white">            
                                            <tr><td>                
                                                <table cellpadding="6" cellspacing="6" width="975px" class="pageBackGround">
                                                    <tr><td class="fontWhiteBold" colspan="3"><h2>Cinemas - View Movie</h2></td></tr>
                                                    <tr>
                                                        <td width="20%">Movies</td><td width="1px">:</td><td>  <%: Html.DropDownListFor(model => model.MovieCode, (SelectList)ViewData["MovieList"])%></td>
                                                    </tr>
                                                    <tr><td>Cinemas</td><td width="1px">:</td><td> <%: Html.DropDownList("DdlCinema", (SelectList)ViewData["CinemaList"])%></td></tr>
                                                    <tr><td>Cinema Halls</td><td width="1px">:</td><td><%: Html.DropDownListFor(model => model.CinemaHallID, new SelectList(new List<OnlineMovieTicket.Model.CinemaHall>(), "CinemaHallID", "CinemaHallName"))%></td></tr>
                                                    <tr><td>Showing Date</td><td width="1px">:</td><td>  <%= Html.TextBox("ShowingDate",DateTime.Today.Date.ToString("dd-MMM-yyyy"))%>
                                                                                                         <%: Html.ValidationMessageFor(model => model.ShowingDate)%></td></tr>
                                                                                                            

                                                    <tr><td colspan="3"><input type="submit" name="SearchButton" value="Search" class="btn"/></td></tr>
                                                    <tr><td colspan="3" height="10px"></td></tr>    
                                                    <tr><td colspan="3">
                                                         <div id="SearchResult">
                                                            <%if (Model.MovieTimeTableList != null && Model.MovieTimeTableList.Count() > 0)
                                                              {
                                                                  Html.RenderPartial("SearchResult", Model.MovieTimeTableList);
                                                              } %>
                                                        </div>
                                                    </td></tr>
                                                     <tr><td colspan="3" height="10px"> <%= Html.ActionLink("Create Movie", "CreateMovieAssignment") %></td></tr>                                               
                                                </table>            
                                            </td></tr>
                                        </table>    
                                    </td></tr>
                                    <tr><td height="10px" colspan="3"></td></tr>
                </table>
                <% } %>
     
       
    <% } %>

  

    <script type="text/javascript">

        $(document).ready(function () {
            $("#DdlCinema").change(function () {
                GetCinemaHallList();
            });
        });

        function GetCinemaHallList() {
            //build the request url   
            var url = "/MovieAssignment/GetCinemaHallList";

            //fire off the request, passing it the id which is the MakeID's selected item value   
            $.getJSON(url, { CinemaID: $("#DdlCinema").val() }, function (data) {
                //Clear the Model list   
                $("#CinemaHallID").empty();

                //Foreach Model in the list, add a model option from the data returned   
                $.each(data, function (index, optionData) {
                    $("#CinemaHallID").append("<OPTION value='" + optionData.Value + "'>" + optionData.Text + "</OPTION>");
                });

            });
        }
    </script>
</asp:Content>


